 Imports MySql.Data.MySqlClient 
 Imports System.Data.OleDb
Imports System.Data.SqlClient
 Imports System .Data .SqlServerCe 
 Imports System.Data.OracleClient 
Imports System.Data
Imports DTO
Public Class MONDao
Inherits AbstractDao
 #Region "New" 
 Public Sub New(ByVal connection As KetNoiDto)
 MyBase.New(connection)
 End Sub
 Public Sub New( ByVal IDMON As System.Int32, ByVal connection As KetNoiDto)
 MyBase.New("MON", "select * from MON where IDMON=" & IDMON & "", connection)
 End Sub
 #End Region 
 Public Sub Them(ByVal Dto As MONDto)
 Dim strsql As String
 strsql = "Insert into MON(TENMON,IDCAPHOC,TRANGTHAI,GHICHU) values (?,?,?,?)
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 Dim cmd As New OleDbCommand(strsql, Ket_noi_access)
cmd.Parameters.Add("@TENMON", OleDbType.VarWChar)
cmd.Parameters.Add("@IDCAPHOC", OleDbType.Integer)
cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
cmd.Parameters("@TENMON").Value = Dto.TENMON
cmd.Parameters("@IDCAPHOC").Value = Dto.IDCAPHOC
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 strsql = "Select @@IDENTITY"
 cmd = New OleDbCommand(strsql, Ket_noi_access)
 Dto.IDMON = cmd.ExecuteScalar()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress
 strsql = "Insert into MON(TENMON,IDCAPHOC,TRANGTHAI,GHICHU) values (@TENMON,@IDCAPHOC,@TRANGTHAI,@GHICHU)
 Dim cmd As New sqlCommand(strsql, Ket_noi_sql)
cmd.Parameters.Add("@TENMON", SqlDbType.NVarChar)
cmd.Parameters.Add("@IDCAPHOC", SqlDbType.Int)
cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
cmd.Parameters("@TENMON").Value = Dto.TENMON
cmd.Parameters("@IDCAPHOC").Value = Dto.IDCAPHOC
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 strsql = "Select @@IDENTITY"
 cmd = New sqlCommand(strsql, Ket_noi_sql)
 Dto.IDMON = cmd.ExecuteScalar()
 Case Class_KieuDL.SqlCe
 strsql = "Insert into MON(TENMON,IDCAPHOC,TRANGTHAI,GHICHU) values (@TENMON,@IDCAPHOC,@TRANGTHAI,@GHICHU)
 Dim cmd As New sqlceCommand(strsql, Ket_noi_SqlCe)
cmd.Parameters("@TENMON").Value = Dto.TENMON
cmd.Parameters("@IDCAPHOC").Value = Dto.IDCAPHOC
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strsql = "Insert into MON(TENMON,IDCAPHOC,TRANGTHAI,GHICHU) values (@TENMON,@IDCAPHOC,@TRANGTHAI,@GHICHU)
 Dim cmd As New OracleCommand(strsql, Ket_noi_Oracle)
cmd.Parameters("@TENMON").Value = Dto.TENMON
cmd.Parameters("@IDCAPHOC").Value = Dto.IDCAPHOC
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Mysql
 strsql = "Insert into MON(TENMON,IDCAPHOC,TRANGTHAI,GHICHU) values (@TENMON,@IDCAPHOC,@TRANGTHAI,@GHICHU)
 Dim cmd As New MySqlCommand(strsql, Ket_noi_MySql)
cmd.Parameters.Add("@TENMON", MySqlDbType.String)
cmd.Parameters.Add("@IDCAPHOC", MySqlDbType.Int32)
cmd.Parameters.Add("@TRANGTHAI", MySqlDbType.Int32)
cmd.Parameters.Add("@GHICHU", MySqlDbType.String)
cmd.Parameters("@TENMON").Value = Dto.TENMON
cmd.Parameters("@IDCAPHOC").Value = Dto.IDCAPHOC
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub Xoa( ByVal IDMON As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
strSQL = "Delete From MON Where IDMON= ? 
Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
cmd.Parameters.Add("@IDMON",OleDbType.Integer).Value = IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
strSQL = "Delete From MON Where IDMON= @IDMON
Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
cmd.Parameters.Add("@IDMON",SqlDbType.Int).value=IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
strSQL = "Delete From MON Where IDMON=" & IDMON & "
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
strSQL = "Delete From MON Where IDMON=" & IDMON & "
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
strSQL = "Delete From MON Where IDMON=" & IDMON & "
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub sua(ByVal dto As MONDto)
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update MON Set TENMON=? ,IDCAPHOC=? ,TRANGTHAI=? ,GHICHU= ? where IDMON= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
cmd.Parameters.Add("@TENMON", OleDbType.VarWChar)
cmd.Parameters.Add("@IDCAPHOC", OleDbType.Integer)
cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
cmd.Parameters.Add("@IDMON", OleDbType.Integer)
cmd.Parameters("@TENMON").Value = dto.TENMON
cmd.Parameters("@IDCAPHOC").Value = dto.IDCAPHOC
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDMON").Value = dto.IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update MON Set TENMON= @TENMON , IDCAPHOC= @IDCAPHOC , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDMON= @IDMON"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
cmd.Parameters.Add("@TENMON", SqlDbType.NVarChar)
cmd.Parameters.Add("@IDCAPHOC", SqlDbType.Int)
cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
cmd.Parameters.Add("@IDMON", SqlDbType.Int)
cmd.Parameters("@TENMON").Value = dto.TENMON
cmd.Parameters("@IDCAPHOC").Value = dto.IDCAPHOC
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDMON").Value = dto.IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update MON Set TENMON= @TENMON , IDCAPHOC= @IDCAPHOC , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDMON= @IDMON"
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
cmd.Parameters("@TENMON").Value = dto.TENMON
cmd.Parameters("@IDCAPHOC").Value = dto.IDCAPHOC
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDMON").Value = dto.IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update MON Set TENMON= @TENMON , IDCAPHOC= @IDCAPHOC , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDMON= @IDMON"
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
cmd.Parameters("@TENMON").Value = dto.TENMON
cmd.Parameters("@IDCAPHOC").Value = dto.IDCAPHOC
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDMON").Value = dto.IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update MON Set TENMON= @TENMON , IDCAPHOC= @IDCAPHOC , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDMON= @IDMON"
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
cmd.Parameters.Add("@TENMON", MySqlDbType.String)
cmd.Parameters.Add("@IDCAPHOC", MySqlDbType.Int32)
cmd.Parameters.Add("@TRANGTHAI", MySqlDbType.Int32)
cmd.Parameters.Add("@GHICHU", MySqlDbType.String)
cmd.Parameters.Add("@IDMON", MySqlDbType.Int32)
cmd.Parameters("@TENMON").Value = dto.TENMON
cmd.Parameters("@IDCAPHOC").Value = dto.IDCAPHOC
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDMON").Value = dto.IDMON
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub SuaTENMON( ByVal TENMON as System.String, ByVal IDMON As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update MON Set TENMON = ?  where IDMON= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@TENMON", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDMON", OleDbType.Integer)
 cmd.Parameters("@TENMON").Value =  TENMON
cmd.Parameters("@IDMON").Value =  IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update MON Set TENMON = @TENMON  where IDMON= @IDMON"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@TENMON", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDMON", SqlDbType.Int)
 cmd.Parameters("@TENMON").Value =  TENMON
cmd.Parameters("@IDMON").Value =  IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update MON Set TENMON =" & TENMON & "  where IDMON=" & IDMON & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update MON Set TENMON =" & TENMON & "  where IDMON=" & IDMON & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update MON Set TENMON =" & TENMON & "  where IDMON=" & IDMON & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaIDCAPHOC( ByVal IDCAPHOC as System.Int32, ByVal IDMON As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update MON Set IDCAPHOC = ?  where IDMON= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@IDCAPHOC", OleDbType.Integer)
 cmd.Parameters.Add("@IDMON", OleDbType.Integer)
 cmd.Parameters("@IDCAPHOC").Value =  IDCAPHOC
cmd.Parameters("@IDMON").Value =  IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update MON Set IDCAPHOC = @IDCAPHOC  where IDMON= @IDMON"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@IDCAPHOC", SqlDbType.Int)
 cmd.Parameters.Add("@IDMON", SqlDbType.Int)
 cmd.Parameters("@IDCAPHOC").Value =  IDCAPHOC
cmd.Parameters("@IDMON").Value =  IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update MON Set IDCAPHOC =" & IDCAPHOC & "  where IDMON=" & IDMON & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update MON Set IDCAPHOC =" & IDCAPHOC & "  where IDMON=" & IDMON & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update MON Set IDCAPHOC =" & IDCAPHOC & "  where IDMON=" & IDMON & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaTRANGTHAI( ByVal TRANGTHAI as System.Int32, ByVal IDMON As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update MON Set TRANGTHAI = ?  where IDMON= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
 cmd.Parameters.Add("@IDMON", OleDbType.Integer)
 cmd.Parameters("@TRANGTHAI").Value =  TRANGTHAI
cmd.Parameters("@IDMON").Value =  IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update MON Set TRANGTHAI = @TRANGTHAI  where IDMON= @IDMON"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
 cmd.Parameters.Add("@IDMON", SqlDbType.Int)
 cmd.Parameters("@TRANGTHAI").Value =  TRANGTHAI
cmd.Parameters("@IDMON").Value =  IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update MON Set TRANGTHAI =" & TRANGTHAI & "  where IDMON=" & IDMON & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update MON Set TRANGTHAI =" & TRANGTHAI & "  where IDMON=" & IDMON & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update MON Set TRANGTHAI =" & TRANGTHAI & "  where IDMON=" & IDMON & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaGHICHU( ByVal GHICHU as System.String, ByVal IDMON As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update MON Set GHICHU = ?  where IDMON= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDMON", OleDbType.Integer)
 cmd.Parameters("@GHICHU").Value =  GHICHU
cmd.Parameters("@IDMON").Value =  IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update MON Set GHICHU = @GHICHU  where IDMON= @IDMON"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDMON", SqlDbType.Int)
 cmd.Parameters("@GHICHU").Value =  GHICHU
cmd.Parameters("@IDMON").Value =  IDMON
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update MON Set GHICHU =" & GHICHU & "  where IDMON=" & IDMON & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update MON Set GHICHU =" & GHICHU & "  where IDMON=" & IDMON & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update MON Set GHICHU =" & GHICHU & "  where IDMON=" & IDMON & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub layBang()
 Chuoi_SQL = " Select * from MON
 Doc_bang()
 End Sub
 Public Sub layBangTheoIDMON(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "IDMON=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from MON" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoIDMON(ByVal IDMON As System.Int32 )
 Chuoi_SQL = " Select * from MON where  IDMON = " & IDMON & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoIDMON(ByVal IDMON As System.Int32)
 Dim strsql As String
 strSQL = "Delete From MON Where IDMON=" & IDMON & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoTENMON(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "TENMON='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from MON" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoTENMON_like (ByVal TENMON As System.String )
 Chuoi_SQL = " Select * from MON where  TENMON  like '%" & TENMON & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoTENMON(ByVal TENMON As System.String )
 Chuoi_SQL = " Select * from MON where  TENMON = '" & TENMON & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoTENMON(ByVal TENMON As System.String)
 Dim strsql As String
 strSQL = "Delete From MON Where TENMON='" & TENMON & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoIDCAPHOC(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "IDCAPHOC=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from MON" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoIDCAPHOC(ByVal IDCAPHOC As System.Int32 )
 Chuoi_SQL = " Select * from MON where  IDCAPHOC = " & IDCAPHOC & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoIDCAPHOC(ByVal IDCAPHOC As System.Int32)
 Dim strsql As String
 strSQL = "Delete From MON Where IDCAPHOC=" & IDCAPHOC & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoTRANGTHAI(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "TRANGTHAI=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from MON" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoTRANGTHAI(ByVal TRANGTHAI As System.Int32 )
 Chuoi_SQL = " Select * from MON where  TRANGTHAI = " & TRANGTHAI & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoTRANGTHAI(ByVal TRANGTHAI As System.Int32)
 Dim strsql As String
 strSQL = "Delete From MON Where TRANGTHAI=" & TRANGTHAI & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoGHICHU(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "GHICHU='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from MON" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoGHICHU_like (ByVal GHICHU As System.String )
 Chuoi_SQL = " Select * from MON where  GHICHU  like '%" & GHICHU & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoGHICHU(ByVal GHICHU As System.String )
 Chuoi_SQL = " Select * from MON where  GHICHU = '" & GHICHU & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoGHICHU(ByVal GHICHU As System.String)
 Dim strsql As String
 strSQL = "Delete From MON Where GHICHU='" & GHICHU & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangNhieuTable
 Chuoi_SQL = " Select IDMON ,TENMON ,IDCAPHOC ,TRANGTHAI ,GHICHU  from MON"
 Doc_bang()
 End sub
Public Sub TaoTable()
Dim strsql As String
strsql = ""
Select Case ketnoi.MsSql
Case Class_KieuDL.Access 
Case Class_KieuDL.Sql, Class_KieuDL.sqlExpress
strsql = ""
Case Class_KieuDL.SqlCe
strsql = ""
Case Class_KieuDL.Oracle
strsql = ""
Case else 
strsql = ""
End Select
Thuc_hien_lenh(strsql)
End Sub
 End Class

